﻿namespace NTLib.Pipe.Network.Formats
{
    using NTLib.Core.Attributes;
    using NTLib.Core.Component;
    using NTLib.Core.Memory;
    using NTLib.Core.Reflection;
    using NTLib.Pipe.Network.Containers;
    using Streaming.Containers;
    using Streaming.Descriptors.Packages;
    using Streaming.Formats;
    using System;


    /// <summary>
    /// 
    /// </summary>
    [Guid("d3b397fa-cc8e-47ca-8eb4-75c78b2fd83b")]
    [ConcurrentComponent]
    public class HttpPackageFormats : Disposable, IPackageFormater
    {
        #region Fields

        private readonly Guid _localID;

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="HttpPackageFormats"/> class.
        /// </summary>
        public HttpPackageFormats()
        {
            this._localID = this.GetType().GetMandatoryAttribute<GuidAttribute>().Value;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the identifier.
        /// </summary>
        public Guid Id
        {
            get { return this._localID; }
        }

        /// <summary>
        /// Gets the reader descriptor.
        /// </summary>
        public IPackageDescriptor ReaderDescriptor
        {
            get { return null; }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Froms the package.
        /// </summary>
        public T FromPackage<T>(IPackage pkg)
        {
            return (T)FromPackage(pkg, typeof(T));
        }

        public object FromPackage(IPackage pkg, Type T)
        {
            throw new NotImplementedException();
        }

        public IPackage ToPackage<T>(T data)
        {
            HttpPackage pkg = new HttpPackage();
            if (data != null)
            {

            }
            return pkg;
        }

        #endregion
    }
}
